<cfcomponent output="false">

	<cffunction name="read" output="false" access="public" returntype="slr.components.cfgenerated.Medicao_Detail.TecnicaBean">
		<cfargument name="id" required="true">
		<cfset var qRead="">
		<cfset var obj="">

		<cfquery name="qRead" datasource="BRUST">
			select 	medicaoId, tecnicaId, tipoDisparoId, incidencia, tensao, corrente
			from dbo.Tecnica
			where tecnicaId = <cfqueryparam cfsqltype="CF_SQL_INTEGER" value="#arguments.id#" />
		</cfquery>

		<cfscript>
			obj = createObject("component", "slr.components.cfgenerated.Medicao_Detail.TecnicaBean").init();
			obj.setmedicaoId(qRead.medicaoId);
			obj.setTecnicaId(qRead.tecnicaId);
			obj.setTipoDisparoId(qRead.tipoDisparoId);
			obj.setIncidencia(qRead.incidencia);
			obj.setTensao(qRead.tensao);
			obj.setCorrente(qRead.corrente);
			return obj;
		</cfscript>
	</cffunction>

	<cffunction name="create" output="false" access="public" returntype="void">
		<cfargument name="bean" required="true" type="slr.components.cfgenerated.Medicao_Detail.TecnicaBean">
		<cfset var qCreate="">

		<cfset var qGetId="">

		<cfset var local0=arguments.bean.getmedicaoId()>
		<cfset var local2=arguments.bean.getTecnicaId()>
		<cfset var local3=arguments.bean.getTipoDisparoId()>
		<cfset var local4=arguments.bean.getIncidencia()>
		<cfset var local5=arguments.bean.getTensao()>
		<cfset var local6=arguments.bean.getCorrente()>

		<cfquery name="qCreate" datasource="BRUST">
			insert into dbo.Tecnica(medicaoId, tipoDisparoId, incidencia, tensao, corrente)
			values (
				<cfqueryparam value="#local0#" cfsqltype="CF_SQL_INTEGER" null="#iif((local0 eq ""), de("yes"), de("no"))#" />,
				<cfqueryparam value="#local3#" cfsqltype="CF_SQL_INTEGER" null="#iif((local3 eq ""), de("yes"), de("no"))#" />,
				<cfqueryparam value="#local4#" cfsqltype="CF_SQL_FLOAT" null="#iif((local4 eq ""), de("yes"), de("no"))#" />,
				<cfqueryparam value="#local5#" cfsqltype="CF_SQL_FLOAT" null="#iif((local5 eq ""), de("yes"), de("no"))#" />,
				<cfqueryparam value="#local6#" cfsqltype="CF_SQL_FLOAT" null="#iif((local6 eq ""), de("yes"), de("no"))#" />
			)
		</cfquery>

		<!--- If your server has a better way to get the ID that is more reliable, use that instead --->
		<cfquery name="qGetID" datasource="BRUST">
			select tecnicaId
			from dbo.Tecnica
			order by tecnicaId desc
		</cfquery>
		<cfscript>
			arguments.bean.setTecnicaId(qGetID.tecnicaId);
		</cfscript>
	</cffunction>

	<cffunction name="update" output="false" access="public" returntype="void">
		<cfargument name="bean" required="true" type="slr.components.cfgenerated.Medicao_Detail.TecnicaBean">
		<cfset var qUpdate="">

		<cfquery name="qUpdate" datasource="BRUST" result="status">
			update dbo.Tecnica
			set medicaoId = <cfqueryparam value="#arguments.bean.getmedicaoId()#" cfsqltype="CF_SQL_INTEGER" null="#iif((arguments.bean.getmedicaoId() eq ""), de("yes"), de("no"))#" />,
				tipoDisparoId = <cfqueryparam value="#arguments.bean.getTipoDisparoId()#" cfsqltype="CF_SQL_INTEGER" null="#iif((arguments.bean.getTipoDisparoId() eq ""), de("yes"), de("no"))#" />,
				incidencia = <cfqueryparam value="#arguments.bean.getIncidencia()#" cfsqltype="CF_SQL_FLOAT" null="#iif((arguments.bean.getIncidencia() eq ""), de("yes"), de("no"))#" />,
				tensao = <cfqueryparam value="#arguments.bean.getTensao()#" cfsqltype="CF_SQL_FLOAT" null="#iif((arguments.bean.getTensao() eq ""), de("yes"), de("no"))#" />,
				corrente = <cfqueryparam value="#arguments.bean.getCorrente()#" cfsqltype="CF_SQL_FLOAT" />
			where tecnicaId = <cfqueryparam value="#arguments.bean.getTecnicaId()#" cfsqltype="CF_SQL_INTEGER">
		</cfquery>
	</cffunction>

	<cffunction name="delete" output="false" access="public" returntype="void">
		<cfargument name="bean" required="true" type="slr.components.cfgenerated.Medicao_Detail.TecnicaBean">
		<cfset var qDelete="">

		<cfquery name="qDelete" datasource="BRUST" result="status">
			delete
			from dbo.Tecnica
			where tecnicaId = <cfqueryparam cfsqltype="CF_SQL_INTEGER" value="#arguments.bean.getTecnicaId()#" />
		</cfquery>

	</cffunction>

</cfcomponent>